/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bluetoothserver.dataStore;

import java.util.ArrayList;

/**
 *
 * @author Philip
 */
public class CommentCollection {
    private volatile static CommentCollection instance;
    private ArrayList<Comment> comments;

    private CommentCollection(){
        comments = new ArrayList<Comment>();
        Comment c = new Comment("a","Hello");
        comments.add(c);
    }

    public static CommentCollection getInstance(){
        if(instance == null){
            synchronized(CommentCollection.class){
                if(instance == null){
                    instance =new CommentCollection();
                }
            }
        }
        return instance;
    }

    public void addComment(String add,String com){
        Comment c = new Comment(add,com);
        addComment(c);
    }

    public void addComment(Comment c){
        comments.add(c);
    }

    public void clearComments(){
        comments.clear();
    }

    public Comment getComment(int i){
        return comments.get(i);
    }

    public ArrayList<Comment> getAllComments(){
        return comments;
    }
}
